package routes

import (
	"game-server/app/controllers/admin"
	"game-server/app/controllers/app"
	"game-server/app/middleware"
	"game-server/app/services"

	"github.com/gin-gonic/gin"
)

// SetGameGroupRoutes 定义 Game 分组路由
func SetGameGroupRoutes(router *gin.RouterGroup) {

	authRouter := router.Group("/front")
	{
		authRouter.POST("/game/list", app.GamePageList)
		//游戏点击量+1
		authRouter.POST("/game/click", app.GameClick)
		//门户根据id获取游戏详情
		authRouter.POST("/game/detail", app.GameDetail)

		// 添加评论相关路由
		authRouter.POST("/game/comment/add", app.GameCommentAdd)   // 添加评论
		authRouter.POST("/game/comment/list", app.GameCommentList) // 获取评论列表
		authRouter.POST("/game/comment/del", app.GameCommentDel)   // 删除评论
	}

	adminRouter := router.Group("/admin").Use(middleware.JWTAuth(services.AdminGuardName))
	{
		adminRouter.POST("/game/add", admin.GameAdd)       // 游戏添加
		adminRouter.POST("/game/list", admin.GameList)     // 游戏列表
		adminRouter.POST("/game/del", admin.GameDel)       // 游戏删除
		adminRouter.POST("/game/update", admin.GameUpdate) // 游戏更新
		//批量删除
		adminRouter.POST("/game/batch/del", admin.GameBatchDel)

		// 管理员评论管理路由
		adminRouter.POST("/game/comment/list", app.GameCommentList) // 评论列表
		adminRouter.POST("/game/comment/del", app.GameCommentDel)   // 删除评论
		// adminRouter.POST("/game/comment/batch/del", app.GameCommentBatchDel) // 批量删除评论
	}
}
